#!/bin/bash
rm -rf dist build
python setup.py py2app

ROOT_DIR=`pwd`
echo $ROOT_DIR
cd dist/RokuRemote.app/Contents/Resources
echo "App created"
echo "Creating images directory under Resources"
mkdir images
echo "Moving image files"
mv *.png images/
mv *.jpg images/

cd $ROOT_DIR

if [ -d "$HOME/rokubuild" ]; then
    echo "Moving app to $HOME/rokubuild directory"
    mv -f dist/RokuRemote.app $HOME/rokubuild
else 
    echo "Direcotory $HOME/rokubuild doesn't exist. App file will be deleted"
fi
echo "Deleting dist build *.egg"
rm -rf dist build *.egg
echo "Done."
